package com.qdh;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class DataFlowWritable implements Writable {
   private Integer up;//上传流量
   private Integer down;//下载流量

    public DataFlowWritable(Integer up, Integer down) {
        this.up = up;
        this.down = down;
    }

    public DataFlowWritable() {

    }

    public Integer getUp() {
        return up;
    }

    public void setUp(Integer up) {
        this.up = up;
    }

    public Integer getDown() {
        return down;
    }

    public void setDown(Integer down) {
        this.down = down;
    }

    @Override//序列化
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(up);
        dataOutput.writeInt(down);
    }

    @Override//反序列化
    public void readFields(DataInput dataInput) throws IOException {
        this.up = dataInput.readInt();
        this.down = dataInput.readInt();
    }
}
